//
//  UIBarButtonItem+Extension.swift
//  iOSWeibo
//
//  Created by why on 16/7/24.
//  Copyright © 2016年 王浩宇. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    //扩展里面只能有便利构造函数
    convenience init(imageName: String) {
        let button = UIButton(type: UIButtonType.Custom)
        button.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        button.setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        button.sizeToFit()
        
        self.init(customView: button)
    }
}